{% extends 'base.html' %}
{% block title %}排名{% endblock title %}

{% block content %}
<div class="container" align="center">
    <form method="post">
        {% csrf_token %}
        <h3>请选择要排序的学生单科成绩</h3>
        <select name="proj">
            <option value="1">高数</option>
            <option value="2">英语</option>
            <option value="3">C语言</option>
            <option value="4">JAVA</option>
            <option value="5">Ptyhon</option>
            <option value="6">数据结构</option>
        </select>
        <td><input type="submit" value="查询"> </td>
    </form>
</div>

<div class="container">
    <h3 style="text-align: center">按选中科目排序的输出结果</h3>
    <table class="table">
    <tr>
        <th>序号</th>
        <th>学号</th>
        <th>姓名</th>
        <th>成绩</th>
    </tr>
        {% for student in stulist %}
        <tr>
        {% if proj == '1' %}
            <td>{{ student.id }}</td>
            <td>{{ student.sno }}</td>
            <td>{{ student.sname }}</td>
            <td>{{ student.math }}</td>
        {% elif proj == '2' %}
            <td>{{ student.id }}</td>
            <td>{{ student.sno }}</td>
            <td>{{ student.sname }}</td>
            <td>{{ student.english }}</td>
        {% elif proj == '3' %}
            <td>{{ student.id }}</td>
            <td>{{ student.sno }}</td>
            <td>{{ student.sname }}</td>
            <td>{{ student.Clanguage }}</td>
        {% elif proj == '4' %}
            <td>{{ student.id }}</td>
            <td>{{ student.sno }}</td>
            <td>{{ student.sname }}</td>
            <td>{{ student.JavaGrade }}</td>
        {% elif proj == '5' %}
            <td>{{ student.id }}</td>
            <td>{{ student.sno }}</td>
            <td>{{ student.sname }}</td>
            <td>{{ student.PythonGrade }}</td>
        {% elif proj == '6' %}
            <td>{{ student.id }}</td>
            <td>{{ student.sno }}</td>
            <td>{{ student.sname }}</td>
            <td>{{ student.DataStruct }}</td>
        {% endif %}
        </tr>
        {% endfor %}
    </table>
</div>
{% endblock %}
